<script>
import CardItems from '@/components/CardItems/index.vue'
import TreeCard from '@/components/TreeCard/index.vue'
import { cardConfig } from './config/cardConfig'
import { popConfig } from './config/popConfig'
import { selectConfig } from './config/selectConfig'
import { headerConfig } from './config/tableConfig'

export default {
  name: 'CarbonPrice',
  components: { TreeCard, CardItems },
  data() {
    return {
      isExpand: true,
      expandLeft: 200,
      type: null,
      nodeSelect: {},
      selectList: []
    }
  },
  methods: {
    selectChange(selectData, prop, selectList) {

    }
  },
  computed: {
    cardConfig() {
      return cardConfig['carbon-price'] || {}
    },
    popConfig() {
      return popConfig['carbon-price'] || {}
    },
    selectConfig() {
      return selectConfig['carbon-price'] || []
    },
    /**
     * 表头配置
     */
    headerConfig() {
      return headerConfig['carbon-price'] || []
    }
  }
}
</script>

<template>
  <div class="carbon-price-box">
    <div class="CardItems-box">
      <CardItems
        ref="cardItemsRef"
        :card-config="cardConfig"
        :outer-params="nodeSelect"
        :pop-config="popConfig"
        :select-config="selectConfig"
        :header-config="headerConfig"
        :dynamic-select-list="selectList"
        @selectChange="selectChange"
      />
    </div>
  </div>
</template>

<style lang="scss" scoped>
.carbon-price-box {
  display: flex;
  width: 100%;
  height: 100%;

  .expand-box {
    position: absolute;
    top: 50%;
    height: 40px;
    line-height: 40px;
    width: 12px;
    text-align: center;
    margin-top: -20px;
    font-size: 12px;
    color: #909399;
    background-color: #ededed;
    border-radius: 0 4px 4px 0;
    transition: left 0.3s;
    cursor: pointer;
    z-index: 3;

    &:hover {
      background-color: #ddd;
    }

    .el-input__icon {
      font-style: normal;
      font-weight: 400;
      font-variant: normal;
      text-transform: none;
      line-height: 1;
      vertical-align: baseline;
      display: inline-block;
    }
  }

  .TreeCard-box {
    height: 100%;
    transition: all 0.3s;

    .tree-card {
      border: 1px solid #eee;
      background-color: #fff;
    }

    &.is-expand {
      overflow: hidden;
      margin-right: 0;
    }
  }

  .CardItems-box {
    flex: 1;
  }
}
</style>

